# -*- coding=utf-8 -*-
from PySide2 import QtCore
from views.MainWindow import MainWindow
from views.SelectPortDialog import SelectPortDialog
from views.ConfigDialog import ConfigDialog

class KeithleyController(QtCore.QObject):
    def __init__(self,parent=None):
        self.mainWindow = MainWindow()
        self.selectPortDialog = SelectPortDialog()
        self.configDialog =  ConfigDialog()
        self.setupConnect()

    def setupConnect(self):
        self.mainWindow.ui.actionOpen.triggered.connect(self.onActionOpen)
        self.mainWindow.ui.actionClose.triggered.connect(self.onActionClose)
        self.mainWindow.ui.actionNewTest.triggered.connect(self.onActionNewTest)
        self.mainWindow.ui.actionNewTestConfig.triggered.connect(self.onActionNewTestConfig)
        self.mainWindow.ui.actionNewTestPlan.triggered.connect(self.onActionNewTestPlan)
        self.mainWindow.ui.actionGenerateReport.triggered.connect(self.onActionGenerateReport)
        self.mainWindow.ui.actionTestBrowser.triggered.connect(self.onActionTestBrowser)
        self.mainWindow.ui.actionOption.triggered.connect(self.onActionOption)
        self.mainWindow.ui.pushButtonStart.clicked.connect(self.onStart)
        self.mainWindow.ui.pushButtonStop.clicked.connect(self.onStop)
        self.mainWindow.ui.pushButtonPause.clicked.connect(self.onPause)
        self.mainWindow.ui.pushButtonContinue.clicked.connect(self.onContinue)

    @QtCore.Slot()
    def onActionOpen(self):
        ok = self.selectPortDialog.exec_()
        print(ok)
        pass

    @QtCore.Slot()
    def onActionClose(self):
        pass

    @QtCore.Slot()
    def onActionNewTest(self):
        pass

    @QtCore.Slot()
    def onActionNewTestConfig(self):
        pass

    @QtCore.Slot()
    def onActionNewTestPlan(self):
        pass

    @QtCore.Slot()
    def onActionGenerateReport(self):
        pass

    @QtCore.Slot()
    def onActionTestBrowser(self):
        pass

    @QtCore.Slot()
    def onActionOption(self):
        pass

    @QtCore.Slot()
    def onStart(self):
        pass

    @QtCore.Slot()
    def onStop(self):
        pass

    @QtCore.Slot()
    def onPause(self):
        pass

    @QtCore.Slot()
    def onContinue(self):
        pass
